package com.flyco.modules.job.order;

import com.flyco.modules.oms.service.IOmsOrderService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import groovy.util.logging.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class OrderJob {

    private Logger logger = LoggerFactory.getLogger(OrderJob.class);

    @Autowired
    private IOmsOrderService orderService;

    /**
     * 设置订单是否部分发货
     */
    //@XxlJob("batchSetOrderDivideSendFlag")
    public ReturnT<String> batchSetOrderDivideSendFlag(String param) throws Exception {

        logger.info("batchSetOrderDivideSendFlag 开始运行");


        orderService.batchSetOrderDivideSendFlag();

        //拉取已取消的发货单，更新出库单状态
        orderService.handleCancelJdSendOrder();

        logger.info("batchSetOrderDivideSendFlag 运行结束");
        return ReturnT.SUCCESS;
    }

}
